With the prevalence of Internet and employment of multimedia technique on Internet, the technique for transmitting real-time media stream such as real-time transmission video, audio etc. is now urgently needed. Currently, the real-time media stream data such as video and audio, is commonly transmitted by employing RTP/RTCP protocols (Real-time Transport Protocol/Real-time Transport Control Protocol).
The real-time transport protocol RTP provides time information and realizes stream synchronization; RTP itself can neither provide reliable transport system to transmit data package in order nor traffic control or congestion control service, it provides these services through real-time transport control protocol RTCP; the RTCP and RTP together provide traffic control and congestion control services; during RTP session, each participant transmits RTCP package periodically; the RTCP package comprises statistic information like the amount of data package already transmitted and the amount of lost data package, by which the transport rate can be changed dynamically, even the valid load type can also be changed. By coordinately using RTP and RTCP, effect feedback and least overhead can be achieved as to optimize transport efficiency, therefore, they are especially suitable for transporting real-time data on network. Commonly, RTP/RTCP algorithm is not realized as an independent network layer, rather it is realized as a part of application code. The RTP/RTCP commonly uses UDP (User Datagram Protocol) to transmit data; when the application starts a RTP/RTCP session, it will use two local ports: one is assigned to RTP, the other to RTCP.
FIG. 1 is the conventional sending flowchart of RTP/RTCP data package within a computing device. When said RTP/RTCP application program transports the real-time media stream data package, it will call “SendTo( )” function of SOCKET API and within the SOCKET layer through functions such as “sendit( )” and “sosend( )” perform the following operations: “sendit( )” function preparing data structure “msghdr” required for “sosend( )” system calling, initializing “uio” structure, constructing “MBUF,” collecting the data in output buffer designated by process into the core buffer, copying the control and address information in process space into core, and finally transporting interface, destination address, “uio” structure, control information, flag and all the like to the function “sosend( )”; the function “sosend( )” is for checking error condition and waiting for idle space in transport buffer, when checking error condition, in order to prevent the buffer from changing, first hanging up protocol process, copying the data from process into the core, and transporting the data to interface-related UDP protocol layer by calling “udp_output( )”. UDP layer is used for analysising the control information, data and their validity, connecting an unconnected interface temporarily, filling the field of “udpiphdr” structure, preparing fake head for check and calculation, calculating check sum, length of filling UDP, TTL (Time to Live) and TOS (Type of Service) etc., and finally calling “ip_output( )” to send the data package to IP layer. Within the IP layer, perform the following operations: initializing IP head, determining a route to destination and obtaining MAC (Media Access Control) address of next hop to ensure that the IP head has a effective address, copying data and calculating check sum, submitting the package to route-related interface “if_output( )” function to finish filling Ethernet head data, and finally calling the sending function of net interface driven layer. Said sending function of net interface driven layer copies the Ethernet package data in “MBUF” and drives the network interface hardware to transmit the data to physical layer.
FIG. 2 is the conventional receiving flowchart of RTP/RTCP data package in a computing device. Upon net interface reception function (i.e. Net interface driven Ethernet frame reception function) receiving one UDP based RTP/RTCP real-time media stream data package, a recalling function “ether_input( )” registered through TCP/IP (Transmission Control Protocol/Internet Protocol) protocol stack uploads the data to the TCP/IP protocol stack; after the process of IP protocol stack layer, the data is further distributed to the UDP layer for processing, then a “udp_input( )” function in UDP layer finds corresponding reception SOCKET in order according to the destination port number in the UDP data package, and deposits the data into corresponding reception buffer, as such the process of layer-dividing package-breaking is performed. RTP/RTCP protocol layer application will call “recvfrom( )” function to read data from SOCKET reception buffer and put the data into the application task buffer every a certain interval of time.
From experiment and analysis, it is found that employing the method for transmitting RTP/RTCP data package in media gateway, IAD, IP multimedia terminal involves some unnecessary processes, resulting in low process efficiency, representing in the following three detailed aspects:
1. The real-time media stream data is carried on UDP through the RTP/RTCP data package, according to the characteristic of RTP/RTCP data package, the application of RTP/RTCP protocol layer has already determined the original IP, original PORT, destination IP, destination PORT etc., while the standard TCP/IP protocol stack and SOCKET layer also have many analysis and judgment processes for protocol and address, whose results are obviously known, redundant and unnecessary for the transmission of RTP/RTCP data package.
2. The standard TCP/IP protocol stack fills the related data package field in different layers, and processes different protocol layer data layer by layer, so the number of layers is large, resulting in many dynamic memory application operations, requiring for a lot of operations of data structure conversion, data copy and data judgment which are time-consuming and will occupy a large part of CPU (Central Processing Unit) resource. According to the characteristic of the real-time media stream RTP/RTCP data package in a session, the real-time media stream data package transmitting from application to network driver can be realized by a new process function, skipping over the SOCKET layer and standard protocol stack.
3. When sending data by the standard TCP/IP protocol stack, the operations of route and ARP (Address Resolution Protocol) lookup for each data package have to be performed, which are very time-consuming. According to the characteristic of the real-time media stream RTP/RTCP data package in a session, software can employ port based ARP policy to greatly decrease the time-consuming operations of route and ARP lookup.
There are also some unnecessary processes in using the method for receiving RTP/RTCP data package in media gateway, IAD, IP multimedia terminal etc., resulting in low process efficiency, representing in the following two detailed aspects:
1. The process of layer-dividing package-breaking involves many redundant and time-consuming operations, such as judging protocol type, address information and data validity for multiple times, conversing data structure for multiple times, and copying data for multiple times, which are unnecessary for the UDP data reception in the scope of known port.
2. The application of RTP/RTCP protocol layer receiving data by employing SOCKET programming timing inquiry form greatly increases time-delay, and wastes the CPU resource.
As described above, in the conventional RTP/RTCP data package processing, the RTP/RTCP application layer accomplishes interfacing through SOCKET API and TCP/IP protocol stack, and the TCP/IP protocol stack and network driver layer accomplish the reception and sending of data. In the direction of sending, the RTP/RTCP application layer program calls the SOCKET API sending function to send the data, with a low process efficiency; in the direction of receiving, the RTP/RTCP protocol application calls the SOCKET API receiving function to receive the data package in the form of time inquiry, and performs layer-dividing package-breaking process, also with a low process efficiency.